package com.onpositive.dataminer.core;

import java.util.ArrayList;
import java.util.Arrays;

import com.onpositive.knowledge.model.inference.InferTransformer;
import com.onpositive.knowledge.model.inference.InferenceUtils;
import com.onpositive.semantic.model.api.meta.DefaultMetaKeys;
import com.onpositive.semantic.model.api.meta.IWritableMeta;
import com.onpositive.semantic.model.api.property.java.UseSetter;

public class InferenceFormulasMetaAcccessor {

	protected IWritableMeta meta;

	public InferenceFormulasMetaAcccessor(IWritableMeta meta) {
		super();
		this.meta = meta;
	}

	public ArrayList<String> getFormulas() {
		return new ArrayList<String>(Arrays.asList(meta.getSingleValue(
				InferenceUtils.EXPRESSION_TO_INFER, String[].class,
				new String[0])));
	}


	@UseSetter
	public void setFormulas(ArrayList<String> formulas) {
		if (formulas.size() == 0) {
			meta.putMeta(InferenceUtils.EXPRESSION_TO_INFER, null);
		} else {
			meta.putMeta(InferenceUtils.EXPRESSION_TO_INFER,
					formulas.toArray(new String[formulas.size()]));
		}
	}
	
	public Object getDefaultValue(){
		return meta.getSingleValue(DefaultMetaKeys.DEFAULT_VALUE, Object.class, null);
	}
	public void setDefaultValue(Object value){
		meta.putMeta(DefaultMetaKeys.DEFAULT_VALUE, value);
	}
}
